﻿using CRM.Admin.Contracts.Model.Customer;
using CRM.Admin.Contracts.Model.Map;
using KingsSharp.Core.Data.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CRM.Admin.Services.EntityConfigurations.Map
{
    /// <summary>
    /// 需求情况-按地区信息配置
    /// </summary>
    public class AreaRequstCfg : EntityConfigurationBase<AreaRequstInfo, Guid>
    {
        public AreaRequstCfg()
        {
            Property(t => t.Area).HasMaxLength(50);
            Property(t => t.Province).HasMaxLength(50);
            Property(t => t.City).HasMaxLength(50);
            Property(t => t.ProdName).HasMaxLength(100);
            Property(t => t.ReqWt).HasPrecision(8, 1);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f=>f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f=>f.UpdateById);
        }
    }
    /// <summary>
    /// 需求情况按行业信息配置
    /// </summary>
    public class IndustryRequstCfg : EntityConfigurationBase<IndustryRequstInfo, Guid>
    {
        public IndustryRequstCfg()
        {
            Property(t => t.Area).HasMaxLength(50);
            Property(t => t.Province).HasMaxLength(50);
            Property(t => t.Industry).HasMaxLength(50);
            Property(t => t.ProdName).HasMaxLength(100);
            Property(t => t.ReqWt).HasPrecision(8, 1);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f => f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f => f.UpdateById);
        }
    }
    /// <summary>
    /// 需求情况按终端用户
    /// </summary>
    public class UserRequstCfg : EntityConfigurationBase<UserRequstInfo, Guid>
    {
        public UserRequstCfg()
        {
            Property(t => t.Area).HasMaxLength(50);
            Property(t => t.Province).HasMaxLength(50);
            Property(t => t.ProvinceArea).HasMaxLength(50);
            Property(t => t.City).HasMaxLength(50);
            Property(t => t.Industry).HasMaxLength(50);
            Property(t => t.ProdName).HasMaxLength(100);
            Property(t => t.FinUserName).HasMaxLength(100);
            Property(t=>t.FinUserProfIles).HasMaxLength(2000);
            Property(t => t.ReqWt).HasPrecision(8, 1);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f => f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f => f.UpdateById);
        }
    }
    /// <summary>
    /// 供给情况信息配置
    /// </summary>
    public class SupplyCfg : EntityConfigurationBase<SupplyInfo, Guid>
    {
        public SupplyCfg()
        {
            Property(t => t.Area).HasMaxLength(50);
            Property(t => t.Province).HasMaxLength(50);
            Property(t => t.SteelFactory).HasMaxLength(50);
            Property(t => t.SteelFactoryArea).HasMaxLength(50);
            Property(t => t.ProportIon).HasPrecision(8, 1);
            Property(t => t.SupWt).HasPrecision(8, 1);
            Property(t => t.ProdName).HasMaxLength(100);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f => f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f => f.UpdateById);
        }
    }
    /// <summary>
    /// 网店简介-信息配置
    /// </summary>
    public class NetworkCfg : EntityConfigurationBase<NetworkInfo, Guid>
    {
        public NetworkCfg()
        {
            Property(t => t.NetworkArea).HasMaxLength(50);
            Property(t => t.Profiles).HasMaxLength(2000);
            Property(t => t.NetworkName).HasMaxLength(100);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f => f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f => f.UpdateById);
            Property(t => t.Latitude).HasPrecision(18,8);
            Property(t => t.Longitude).HasPrecision(18,8);
            Property(t=>t.County).HasMaxLength(50);
        }
    }
    /// <summary>
    /// 销售流向-信息配置
    /// </summary>
    public class SaleCfg : EntityConfigurationBase<SaleInfo, Guid>
    {
        public SaleCfg()
        {
            Property(t => t.Area).HasMaxLength(50);
            Property(t => t.Province).HasMaxLength(50);
            Property(t => t.Industry).HasMaxLength(50);
            Property(t => t.ProdName).HasMaxLength(100);
            Property(t => t.SaleWt).HasPrecision(8, 1);
            Property(t => t.ProportIon).HasPrecision(8, 1);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f => f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f => f.UpdateById);
        }
    }
    /// <summary>
    /// 简介
    /// </summary>
    public class AreaProfilesCfg : EntityConfigurationBase<AreaProfilesInfo, Guid>
    {
        public AreaProfilesCfg()
        {
            Property(t => t.Area).HasMaxLength(100);
            Property(t => t.Profiles).HasMaxLength(2000);
            HasRequired(t => t.CreateBy).WithMany().HasForeignKey(f => f.CreateById);
            HasOptional(t => t.UpdateBy).WithMany().HasForeignKey(f => f.UpdateById);
        }
    }
}
